package com.jack006.api.controller.article;

import com.jack006.grace.result.GraceJSONResult;
import com.jack006.pojo.bo.NewArticleBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Date;

/**
 * @Classname ArticleControllerApi
 * @Description 文章业务
 * @Date 2021-07-05 20:49
 * @Created by jack
 */
@Api(value = "文章业务的 controller",tags = "文章业务的 controller")
@RequestMapping("article")
public interface ArticleControllerApi {


    @ApiOperation(value = "用户发文",notes = "用户发文",httpMethod = "POST")
    @PostMapping("/createArticle")
    GraceJSONResult createArticle(@Valid @RequestBody NewArticleBO newArticleBO);

    @ApiOperation(value = "查询用户的所有文章列表",notes = "查询用户的所有文章列表",httpMethod = "POST")
    @PostMapping("/queryMyList")
    GraceJSONResult queryMyList(@RequestParam("userId") String userId,
                                @RequestParam("keyword") String keyword,
                                @RequestParam("status") Integer status,
                                @RequestParam("startDate") Date startDate,
                                @RequestParam("endDate") Date endDate,
                                @RequestParam("page") Integer page,
                                @RequestParam("pageSize") Integer pageSize);

    @ApiOperation(value = "管理员查询用户的所有文章列表",notes = "管理员查询用户的所有文章列表",httpMethod = "POST")
    @PostMapping("/queryAllList")
    GraceJSONResult queryAllList(@RequestParam("status")Integer status,
                                 @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                                 @RequestParam("page") Integer page,
                                 @ApiParam(name = "pageSize", value = "分页的每一页显示的条数", required = false)
                                 @RequestParam("pageSize") Integer pageSize);


    @ApiOperation(value = "管理员进行审核通过或者失败",notes = "管理员进行审核通过或者失败",httpMethod = "POST")
    @PostMapping("/doReview")
    GraceJSONResult doReview(@RequestParam("articleId")String articleId,
                             @RequestParam("passOrNot") Integer passOrNot);

    @ApiOperation(value = "文章删除",notes = "文章删除",httpMethod = "POST")
    @PostMapping("/delete")
    GraceJSONResult delete(@RequestParam("userId") String userId,
                           @RequestParam("articleId")String articleId);

    @ApiOperation(value = "文章撤回",notes = "文章撤回",httpMethod = "POST")
    @PostMapping("/withdraw")
    GraceJSONResult withdraw(@RequestParam("userId") String userId,
                             @RequestParam("articleId")String articleId);


}


